import React, { Component } from 'react';
import { Button, InputItem, WhiteSpace,Toast } from 'antd-mobile';
import { connect } from 'react-redux'
import { Redirect } from 'react-router-dom'
import { clickTest } from '../../redux/test.redux'
@connect(
    state => state.TestRedux,
    { clickTest }
)
class Test extends Component {
    constructor(props) {
        super(props)
        this.state = {
            user: '',
            pwd: ''
        }
    }
    componentWillReceiveProps(nextProps){
        console.log(nextProps.msg)
        // if(nextProps.msg){
        //     Toast.fail(JSON.stringify(nextProps.msg), 1);
        // }
    }
    handleTest=()=>{
        this.props.clickTest(this.state)
    }
    render() {
        const boss = "luoeji"
        return (
            <div className="App">
                {this.props.msg ? <p className='error-msg'>{JSON.stringify(this.props.msg)}</p> : '暂无信息'}
                <WhiteSpace />
                <Button type="primary"
                    onClick={()=>this.handleTest()}
                >测试</Button>
            </div>
        );
    }
}

export default Test;
